package com.halflife.comeElectricity.member.rider;

import com.halflife.comeElectricity.basic.datadic.Charge;
import com.halflife.comeElectricity.basic.datadic.DataDic;
import com.halflife.comeElectricity.basic.datadic.Deposit;
import com.halflife.comeElectricity.basic.datadic.RentType;
import com.halflife.comeElectricity.batteryCabinet.BatteryCabinet;
import com.halflife.framework.generator.annotation.Join;
import com.halflife.framework.generator.annotation.QueryAnn;
import com.halflife.framework.generator.build.UpdataBuilder;
import com.halflife.framework.participant.Company;
import com.halflife.framework.participant.Department;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;

@QueryAnn(title = "会员",mainTitle = "会员管理",table = "t_rider")
public class Rider {
    @Test
    public void generateUpdate()throws Exception{
        UpdataBuilder builder = new UpdataBuilder();
//        builder.buildAlterTable(this.getClass());
        builder.buildMapper(this.getClass());
    }
    private Integer id;
    @QueryAnn(value = "编码",refered = true)
    private String unionid;
    @QueryAnn(value = "头像")
    private String img;
    @QueryAnn(value="身份证正面")
    private String cardFront;
    @QueryAnn(value="身份证反面")
    private String cardReverse;
    @QueryAnn(value="备份")
    private String spare;
    @QueryAnn(refered = true,operate = "like")
    private String name;
    @QueryAnn(refered = true,operate = "like")
    private String phone;
    @QueryAnn(value = "身份证号")
    private String carNo;
    @QueryAnn(value = "头像")
    private String idCardNo;
    @QueryAnn(value = "头像")
    private String address;
    @QueryAnn(value = "头像")
    private String addressExt;
    @QueryAnn(value = "身份信用")
    private Integer level;
    @QueryAnn(value = "状态")
    private Integer state;
    @QueryAnn(value = "过期日期")
    private Long endDate;
    @QueryAnn(value = "过期日期")
    private Long jhDate;
    @QueryAnn(value = "电池租赁类型")
    private Integer rentType;
    @QueryAnn(value = "租用类型",custormName = "rentType")
    @Join()
    private RentType rentTypeObj;

    @QueryAnn(value = "剩余金额")
    private BigDecimal balance;
    @QueryAnn(value = "备用联系方式")
    private String sparePhone;
    @QueryAnn(value = "紧急联系人")
    private String spareName;
    @QueryAnn(value = "备注")
    private String memo;
    @QueryAnn(value = "附件")
    private String annex;
    @QueryAnn(value = "部门Id",refered = true)
    private Integer departmentId;
    @QueryAnn(value = "部门",refered = true)
    @Join()
    private Department department;
    @QueryAnn(value = "集团Id")
    private Integer companyId;
    @QueryAnn(value = "名称", operate = "like")
    private String companyName;
    @QueryAnn(persist = false)
    private List<Charge> payTypeList;
    @QueryAnn(persist = false)
    private List<Deposit> depositTypeList;
    @QueryAnn(persist = false)
    private List<DiscountLog> discountLogList;
    @QueryAnn(persist = true)
    private String createDate;

    @QueryAnn(persist = false)
    private String expirDate;
    @QueryAnn(persist = false)
    private String expirJhDate;
    @QueryAnn(persist = false)
    private List<BatteryCabinet> cabinets;

    @QueryAnn(persist = false)
    private Integer days;
    @QueryAnn(persist = false)
    private String scene;
    @QueryAnn(persist = false)
    private Boolean jh = true;

    public Boolean getJh() {
        return jh;
    }

    public void setJh(Boolean jh) {
        this.jh = jh;
    }

    public String getExpirJhDate() {
        return expirJhDate;
    }

    public void setExpirJhDate(String expirJhDate) {
        this.expirJhDate = expirJhDate;
    }

    public List<BatteryCabinet> getCabinets() {
        return cabinets;
    }

    public void setCabinets(List<BatteryCabinet> cabinets) {
        this.cabinets = cabinets;
    }

    public void init() {
        this.level = 0;
        this.state = RiderStatus.NORMAL.getValue();

    }


    public String getStateStr() {
        if (this.getState() == null) {
            return "";
        }
        return RiderStatus.getCNameByValue(this.getState().intValue());
    }

    public String getScene() {
        return scene;
    }

    public void setScene(String scene) {
        this.scene = scene;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUnionid() {
        return unionid;
    }

    public void setUnionid(String unionid) {
        this.unionid = unionid == null ? null : unionid.trim();
    }

    public String getImg() {
        return img;
    }

    public void setImg(String img) {
        this.img = img == null ? null : img.trim();
    }

    public String getSpare() {
        return spare;
    }

    public void setSpare(String spare) {
        this.spare = spare == null ? null : spare.trim();
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone == null ? null : phone.trim();
    }

    public String getCarNo() {
        return carNo;
    }

    public void setCarNo(String carNo) {
        this.carNo = carNo == null ? null : carNo.trim();
    }

    public String getIdCardNo() {
        return idCardNo;
    }

    public void setIdCardNo(String idCardNo) {
        this.idCardNo = idCardNo == null ? null : idCardNo.trim();
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address == null ? null : address.trim();
    }

    public String getAddressExt() {
        return addressExt;
    }

    public void setAddressExt(String addressExt) {
        this.addressExt = addressExt == null ? null : addressExt.trim();
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public BigDecimal getBalance() {
        return balance;
    }

    public void setBalance(BigDecimal balance) {
        this.balance = balance;
    }

    public String getCardFront() {
        return cardFront;
    }

    public void setCardFront(String cardFront) {
        this.cardFront = cardFront;
    }

    public String getCardReverse() {
        return cardReverse;
    }

    public void setCardReverse(String cardReverse) {
        this.cardReverse = cardReverse;
    }

    public Long getEndDate() {
        return endDate;
    }

    public void setEndDate(Long endDate) {
        this.endDate = endDate;
        if (this.endDate != null) {
            int count = (int) ((this.endDate-new Date().getTime()) / (1000*3600*24));
            this.setDays(count);
        }else{
            this.setDays(99999);
        }
    }

    public Integer getRentType() {
        return rentType;
    }

    public void setRentType(Integer rentType) {
        this.rentType = rentType;
    }

    public List<Charge> getPayTypeList() {
        return payTypeList;
    }

    public void setPayTypeList(List<Charge> payTypeList) {
        this.payTypeList = payTypeList;
    }

    public List<Deposit> getDepositTypeList() {
        return depositTypeList;
    }

    public void setDepositTypeList(List<Deposit> depositTypeList) {
        this.depositTypeList = depositTypeList;
    }

    public List<DiscountLog> getDiscountLogList() {
        return discountLogList;
    }

    public void setDiscountLogList(List<DiscountLog> discountLogList) {
        this.discountLogList = discountLogList;
    }

    public String getSparePhone() {
        return sparePhone;
    }

    public void setSparePhone(String sparePhone) {
        this.sparePhone = sparePhone;
    }

    public String getSpareName() {
        return spareName;
    }

    public void setSpareName(String spareName) {
        this.spareName = spareName;
    }

    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public String getAnnex() {
        return annex;
    }

    public void setAnnex(String annex) {
        this.annex = annex;
    }

    public String getExpirDate() {
        return expirDate;
    }

    public void setExpirDate(String expirDate) {
        this.expirDate = expirDate;
    }

    public Integer getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(Integer departmentId) {
        this.departmentId = departmentId;
    }

    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }

    public Integer getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Integer companyId) {
        this.companyId = companyId;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public Integer getDays() {
        return days;
    }

    public void setDays(Integer days) {
        this.days = days;
    }

    public Long getJhDate() {
        return jhDate;
    }

    public void setJhDate(Long jhDate) {
        this.jhDate = jhDate;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public RentType getRentTypeObj() {
        return rentTypeObj;
    }

    public void setRentTypeObj(RentType rentTypeObj) {
        this.rentTypeObj = rentTypeObj;
    }
}